// import { Action } from "redux";
import actionTypes from "./actionTypes";
import { SettingsI, UserI, WeixinOauthI } from "../../types/system";

// Settings
// export interface SetSettingsActionI extends Action {
// 	type: typeof actionTypes.SET_SETTINGS;
// 	payload: Partial<SettingsI>;
// }

// 接收指定类型的参数，返回相应的Action
export const setSettingsAction = (payload: Partial<SettingsI>) => ({
  type: actionTypes.SET_SETTINGS,
  payload,
});

// WeixinOauth
// export interface SetWeixinOauthActionI extends Action {
// 	type: typeof actionTypes.SET_WEIXIN_OAUTH;
// 	payload: Partial<WeixinOauthI>;
// }

// 接收指定类型的参数，返回相应的Action
export const setWeixinOauthAction = (payload: Partial<WeixinOauthI>) => ({
  type: actionTypes.SET_WEIXIN_OAUTH,
  payload,
});

// User
// export interface SetUserActionI extends Action {
// 	type: typeof actionTypes.SET_USER;
// 	payload: Partial<UserI>;
// }

// 接收指定类型的参数，返回相应的Action
export const setUserAction = (payload: Partial<UserI>) => ({
  type: actionTypes.SET_USER,
  payload,
});

export type ActionTypeI =
  | ReturnType<typeof setSettingsAction>
  | ReturnType<typeof setUserAction>
  | ReturnType<typeof setWeixinOauthAction>;
